﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace SimulationGame
{
	public class Civilization
	{
		public List<Human> humans = new List<Human>();
		private Vector2 startPositionInTiles;
		private Random random = new Random();
		public Civilization(int humansInCivilization, Vector2 startPositionInTiles)
		{
			this.startPositionInTiles = startPositionInTiles;
			for (int i = 0; i < humansInCivilization; i++)
			{
				humans.Add(CreateHuman());
			}
		}

		private Human CreateHuman()
		{
			Human human = new Human((int)startPositionInTiles.X + random.Next(5), (int)startPositionInTiles.X + random.Next(2));
			human.huntingLevel = random.Next(5);
			human.miningLevel = random.Next(5);
			human.farmingLevel = random.Next(5);
			human.craftingLevel = random.Next(5);
			human.fightingLevel = random.Next(5);
			human.fishingLevel = random.Next(5);
			return human;
		}
		public void PerformActions()
		{
			foreach (Human human in humans)
			{
				if (!human.hasTask && GameObjectsRegistry.tileMap.tilesMarked.Count > 0)
				{
					human.MineTiles(GameObjectsRegistry.tileMap.tilesMarked);
				}
				human.DoAction();
			}
		}
	}
}
